import {shareBargain} from '../../../Tools/HTTPOpertion.js';
Page({
  data: {
    pageInfo: {
      money: 0,
      ratio: 0,
      name: '',
      join_time: ''
    },
    orderId: 0
  },
  onLoad: function (options) {
     console.log('options.orderId:', options.orderId)
     this.getInfo(options.orderId)
     this.setData({ orderId: options.orderId})
  },
  getInfo: function (orderId) {
    // 获取支付成功之后的详情
    const obj = {
      token: wx.getStorageSync('token'),
      cnd: orderId // 订单ID
    }
    const that = this;
    shareBargain(obj).then(function (res) {
      wx.hideLoading();
      if (res.code === 0) {
         that.setData({ pageInfo: res.data })
      } else {
        wx.showToast({
            title: res.message,
            icon: 'none',
            duration: 2000
        })
      }
    }).catch(function (err) {
        wx.hideLoading();
        console.log(err)
    });
  },
  // 跳转到详情
  goToGoodInfo: function () {
    wx.navigateTo({
        url: `/pages/active/BargainDetails/BargainDetails?id=${this.data.orderId}`
    })
  }
})
